package com.dong.drool.autoconfigure.core;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

/**
 * 规则引擎计算模版
 * @author zhaodongchao
 * @date 2019/4/8 19:41
 */
public abstract class AbstractDroolTemplate {
    private static Logger logger = LoggerFactory.getLogger(AbstractDroolTemplate.class);

    public final void doExecute(Map<String,Object> params){
        logger.info("before execute!");
        beforeExecute();
        try {
            logger.info("executing ...... ");
            execute(params);
            logger.info("executed successful! ");
        } finally {
            logger.info("after execute!");
            afterExecute();
        }
    }
    protected abstract void beforeExecute();
    protected abstract void execute(Map<String,Object> params);
    protected abstract void afterExecute();
}
